package inutan.login.entity;

import inutan.common.entity.Id.GameLongIdEntity;
import org.ricks.common.utils.TimeUtils;
import org.ricks.orm.anno.Column;
import org.ricks.orm.anno.IndexKey;
import org.ricks.orm.anno.Table;

@Table(name = "login_user_info")
public class UserInfo extends GameLongIdEntity<UserInfo> {

    @Column
    @IndexKey
    private String username;

    @Column
    @IndexKey
    private String password;

    @Column
    private int publisher;

    @Column
    private String ip;

    @Column
    private long userToken;

    @Column
    private long createTime = TimeUtils.currentTimeMillis();

    @Column
    private long loginTime = TimeUtils.currentTimeMillis();

    /**
     * 玩家绑定了gateway ，gateway UserSession 销毁而解绑
     */
    @Column
    private String gatewayAddress;

    public UserInfo() {
    }

    public UserInfo(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password =  password;
    }

    public int getPublisher() {
        return publisher;
    }

    public void setPublisher(int publisher) {
        this.publisher = publisher;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public long getUserToken() {
        return userToken;
    }

    public void setUserToken(long userToken) {
        this.userToken = userToken;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public long getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(long loginTime) {
        this.loginTime = loginTime;
    }

    public String getGatewayAddress() {
        return gatewayAddress;
    }

    public void setGatewayAddress(String gatewayAddress) {
        this.gatewayAddress = gatewayAddress;
    }
}
